From 10d13f8ac61c6ae61559837300f1382eb3bd088d Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 5 Feb 2010 10:35:57 +0000 Subject: [PATCH] libxl: notice if vbd virt device specifier ("path") unrecognised Previously, specifying a virtual device string the vbd that couldn't be parsed would result in attempting to actually create the device with vbd number -1 ! Signed-off-by: Ian Jackson --- tools/libxl/libxl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 1689705547..0b1b6dba31 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -1112,6 +1112,11 @@ int libxl_device_disk_add(struct libxl_ctx *ctx, uint32_t domid, libxl_device_di backend_type = device_disk_backend_type_of_phystype(disk->phystype); devid = device_disk_dev_number(disk->virtpath); + if (devid==-1) { + XL_LOG(ctx, XL_LOG_ERROR, "Invalid or unuspported" + " virtual disk identifier %s", disk->virtpath); + return ERROR_INVAL; + } device.backend_devid = devid; device.backend_domid = disk->backend_domid; -- 2.30.2